<widget-modal widget-modal-title="Configure Code Analysis Widget" class="ca-config">
    <form name="configForm" role="form"
          ng-submit="caWidget.submit(caWidget.caCollectorItem, caWidget.saCollectorItem, caWidget.ossCollectorItem, caWidget.testConfigs)"
          novalidate="novalidate">

        <div class="box">

            <form-group input="caCollectorItem" class="text-center">

                <div class="text-center modal-label">Static Code Analysis:</div>

				<input type="text" name="caCollectorItem" class="form-control" placeholder="Search a Code Analysis Job"
					ng-model="caWidget.caCollectorItem"
					uib-typeahead="item as (item.niceName + ' : ' + item.description) for item in getCodeQualityCollectors($viewValue)" typeahead-focus
					typeahead-template-url="sonarProjectUrlTemplate.html"
					typeahead-wait-ms="250" autocomplete="off"
					typeahead-min-length="0"
          typeahead-no-results="noResults"

					required>
          <div class="form-control" ng-show="noResults">
            No Results Found
          </div>

            </form-group>
        </div>


        <div class="form-group text-center">
            <form-group input="saCollectorItem" class="text-center">
            <div class="text-center modal-label">Security Scan:</div>
                <input type="text" name="saCollectorItem" class="form-control" placeholder="Search your SecurityAnalysis job"
                       ng-model="caWidget.saCollectorItem"
                       uib-typeahead="item as (item.collector.name + ' : ' + item.description) for item in getSACollectors($viewValue)" typeahead-focus
                       typeahead-template-url="sonarProjectUrlTemplate.html"
                       typeahead-wait-ms="250" autocomplete="off"
                       typeahead-min-length="0"
                       typeahead-no-results="noResults"
                       required>
                <div class="form-control" ng-show="noResults">
                    No Results Found
                </div>
            </form-group>
        </div>

        <div class="form-group text-center">
            <form-group input="ossCollectorItem" class="text-center">
            <div class="text-center modal-label">Open Source Scan:</div>
                <input type="text" name="ossCollectorItem" class="form-control" placeholder="Search your Open Source scan job"
                       ng-model="caWidget.ossCollectorItem"
                       uib-typeahead="item as (item.collector.name + ' : ' + item.description) for item in getOpenSourceCodeCollectors($viewValue)" typeahead-focus
                       typeahead-template-url="sonarProjectUrlTemplate.html"
                       typeahead-wait-ms="250" autocomplete="off"
                       typeahead-min-length="0"
                       typeahead-no-results="noResults"
                       required>
            <div class="form-control" ng-show="noResults">
                    No Results Found
                </div>
          </form-group>
        </div>


        <form-group class="text-center">
            <div class="text-center modal-label">Functional Tests:</div>

            <div class="form-group text-center" ng-repeat="configItem in caWidget.testConfigs">
                <div class="col-sm-10">
                <input type="text" name="testCollectorItem" class="form-control" placeholder="Select a Functional Test Job"
                       ng-model="configItem.testCollectorItem"
                       uib-typeahead="item as (item.collector.name + ' : ' + item.description) for item in getTestCollectors($viewValue)" typeahead-focus
                       typeahead-template-url="sonarProjectUrlTemplate.html"
                       typeahead-wait-ms="250" autocomplete="off"
                       typeahead-min-length="0"
                       typeahead-no-results="noResults"
                       required>
                <div class="form-control" ng-show="noResults">
                    No Results Found
                </div>
                </div>
                <dash-trash class="fa-lg" ng-click="caWidget.deleteTestConfig(configItem)"></dash-trash>
            </div>
            <div class="form-group text-center"
                 ng-show="caWidget.testConfigs.length==0 || caWidget.testConfigs[caWidget.testConfigs.length-1].testCollectorItem != null">
                <span class="fa fa-plus-circle fa-2x clickable" ng-click="caWidget.addTestConfig()"></span>
            </div>
            <div class="form group text-center">
                <label></label>
                <button type="submit" class="btn btn-primary btn-wide">Save</button>
            </div>
        </form-group>
    </form>
</widget-modal>
<script type="text/ng-template" id="sonarProjectUrlTemplate.html">
	<a title={{match.model.options.instanceUrl}}>
		<span ng-bind-html="match.label | uibTypeaheadHighlight:query"/> 
	</a>
</script>
